package cn.netswap.crate.datasource;


import cn.netswap.crate.autoconfigure.CrateProperties;
import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
import org.springframework.beans.factory.annotation.Autowired;



public class CrateHikariDataSource {
    private  HikariDataSource datasource = null;

    @Autowired(required = false)
    HikariConfig HikariConfig;

    public  HikariDataSource getDataSource() {
        if (datasource == null) {
            synchronized (CrateHikariDataSource.class) {
                if (datasource == null) {
                    datasource = new HikariDataSource(HikariConfig);
                }
            }
        }
        return datasource;
    }




}